package com.hww.v2_mtfsdk.provider;

import android.content.Context;
import android.net.wifi.WifiManager;
import android.os.Build;

import com.hww.common.MyAppThis;
import com.hww.common.util.NetworkUtils;
import com.hww.common.util.SDCardUtils;

import net.facelib.akcore.AuthParameter;
import net.facelib.authkernel.db.DeviceBean;
import net.facelib.live.LiveAupsParameterProvider;

public class ProviderLiveCustom extends LiveAupsParameterProvider {

    public ProviderLiveCustom() {
        String path = String.format("%s/%s.dat", SDCardUtils.getExternalFilesDir(null), getProductID());
        get().put(AuthParameter.LICENSE_FILE, path);
    }

    @Override
    public DeviceBean getDeviceBean() {
        DeviceBean deviceBean = new DeviceBean();
        WifiManager wifi = (WifiManager) MyAppThis.getThis().getApplicationContext().getSystemService(Context.WIFI_SERVICE);
        if (null != wifi) {
            if (wifi.isWifiEnabled()) {
                wifi.setWifiEnabled(true);
            }
            String ssID = wifi.getConnectionInfo().getSSID();
            deviceBean.setSsid(ssID);
        }

        deviceBean.setOs("Android-" + Build.VERSION.RELEASE);
        deviceBean.setArch(Build.CPU_ABI);
        String ip = NetworkUtils.getIPAddress(true);
        deviceBean.setIntranetIp(ip);
        deviceBean.setDeviceName(Build.PRODUCT);
        deviceBean.setModel(Build.MODEL);
        /*设备供应商*/
        deviceBean.setVendor(Build.MANUFACTURER);
        /*设备制造商*/
        deviceBean.setManufacturer("");
        return deviceBean;
    }
}